package hdfs_pro;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class CreateDir {
    public static void main(String[] args) {
        try {
            Configuration conf = new Configuration();
            FileSystem fs = FileSystem.get(conf);
            String dirPath = args[0]; // 新建目录的路径由外部传入
        Path hdfsPath = new Path(dirPath);  
        if(fs.mkdirs(hdfsPath)){
                System.out.println("Directory "+ dirPath +" has been created successfully!");
        }
        }catch(Exception e) {
            e.printStackTrace();
        }
    }
}